/*
Title of the article: "Choosing the risky option: Information and risk propensity in referendum campaigns"
Author: Davide Morisi, University of Vienna
Date: February 28, 2018

/// REPLICATION DO FILE -  EXPERIMENTAL DATA
This file replicates the findings from the experimental data included in the article and in the appendix

There are two experimental studies:
- Study 1: experiment on Scottish referendum
- Study 2: experiment on EU referendum/Brexit referendum
*/


***************************************
***************************************
/// STUDY 1 - SCOTTISH REFERENDUM

*Dataset: "Study1_experiment_scotland.dta"

use "C:\Users\davidem83\Dropbox\01.PAPERS\00. Under review\2016 - Risk - Scotland + Brexit\02. poq\Replication files\Study1_experiment_scotland.dta", clear


************
*RECODING

*DV: Pro-independence attitudes
recode extremity_pro1 99=5, gen(extremity_pro1r)
recode extremity_pro2 99=5, gen(extremity_pro2r)
recode extremity_pro3 99=5, gen(extremity_pro3r)
gen proindep_att = (extremity_pro1r+extremity_pro2r+extremity_pro3r)/30
label variable proindep_att "Pro independence attitudes"
label de proindep_att 0"Min support for independence" 1"Max support for independence"
label values proindep_att proindep_att
ta proindep_att

*Quartiles of risk propensity
xtile risk4 = risk, nq(4)
gen risk401 = (risk4-1)/3
label variable risk401 "Quartiles of risk propensity scale"
label de risk01 0"Very risk averse" 1"Very risk taker"
label values risk401 risk01
tab risk401

*Scottish identity
recode identity (1/2=1 "Scottish identity") (3/6=0 "Not Scottish"), gen(scottishid)
tab scottishid

*Previous knowledge of arguments
gen know_protexts = (know_textpro1+know_textpro2+know_textpro3+know_textpro4)/4 if info==2
label variable know_protexts "Average prior knowledge of pro independence arguments"
label de know_protexts 0"No prior knowledge" 1"Prior knowledge of all arguments"
label values know_protexts know_protexts
tab know_protexts
gen know_contexts = (know_textcon5+know_textcon6+know_textcon7+know_textcon8)/4 if info==2
label variable know_contexts "Average prior knowledge of anti-independence arguments"
label values know_contexts know_protexts
ta know_contexts

*Frequency of search for info on TV
gen media_tv = media_ref1/7
label var media_tv "Frequency of search for news on Scottish ref on TV"
label def media_tv 0 "Never" 1 "Several times a day"
label val media_tv media_tv
ta media_tv

*Frequency of search for info on newspapers
gen media_news = media_ref2/7
label var media_news "Frequency of search for news on Scottish ref on newspapers"
label val media_news media_tv
ta media_news


**************
*ANALYSIS - Tables and figures for paper

*Table 2. Effects of information on pro-independence attitudes (Study 1) and pro-leave at-titudes (Study 2)
*Model 1
reg proindep_att i.info##c.risk401
*Model 2
reg proindep_att i.info##c.risk401 female age4 scottishid

*Figure 2.	Effects of risk propensity on pro-change attitudes by treatment conditions (experimental results)
*Left-hand plot
reg ext_pro01 i.group13##c.risk_quar301 female age_quar201 identityscot
reg proindep_att i.info##c.risk401 female age4 scottishid
margins info, dydx(risk401) level(90) post
coefplot, horiz xline(0) level(90) name(fig2scot)


**************
*ANALYSIS - Tables and figures for appendix

*Table A5. Randomization checks (Study 1, Scottish referendum)
ttest risk, by(info)
ttest age, by(info)
tab female info, col chi2
tab scottishid info, col chi2

*Table A6. Knowledge of arguments and media use by risk propensity (Study 1, Scottish referendum)
recode risk4 (1/2=1 "Risk averse") (3/4=2 "Risk taker"), gen(risk2)
ttest know_protexts if info==2, by(risk2)
ttest know_contexts if info==2, by(risk2)
ttest media_tv if info==2, by(risk2)
ttest media_news if info==2, by(risk2)



**************************************
**************************************
/// STUDY 2 - BREXIT REFERENDUM

*Dataset: "Study2_experiment_brexit.dta"

use "C:\Users\davidem83\Dropbox\01.PAPERS\00. Under review\2016 - Risk - Scotland + Brexit\02. poq\Replication files\Study2_experiment_brexit.dta", clear

*DV: Pro-leave attitudes
recode proleave1 99=5, gen(proleave1r)
recode proleave2 99=5, gen(proleave2r)
recode proleave3 99=5, gen(proleave3r)
gen proleave_att = (proleave1r+proleave2r+proleave3r)/30
label variable proleave_att "Pro Leave attitudes"
label de proleave_att 0"Min support for leaving EU" 1"Max support for leaving EU"
label values proleave_att proleave_att
ta proleave_att

*Treatment groups combined
recode group3 (1=1 "Control (no info)") (2/3=2 "Info (combined groups)"), gen(group2)
label variable group2 "Group assignment - combined treatment groups"
tab group2

*Quartiles of risk propensity
xtile risk4 = riskW1, nq(4)
gen risk401 = (risk4-1)/3
label variable risk401 "Quartiles of risk propensity scale"
label de risk01 0"Very risk averse" 1"Very risk taker"
label values risk401 risk01
tab risk401

*EU identity
recode eu_identityW1 (3/4=0 "No") (1/2=1 "Yes") (99=.), gen(euid_dum)
label variable euid_dum "Do you feel citizen of the EU?"
tab euid_dum

*Previous knowledge of arguments
gen know_leavetexts = (know_leave2+know_leave4+know_leave6+know_leave8)/4 if group2==2
label variable know_leavetexts "Average prior knowledge of pro leave arguments"
label de know_leavetexts 0"No prior knowledge" 1"Prior knowledge of all arguments"
label values know_leavetexts know_leavetexts
tab know_leavetexts
gen know_remaintexts = (know_remain1+know_remain3+know_remain5+know_remain7)/4 if group2==2
label variable know_remaintexts "Average prior knowledge of pro remain arguments"
label values know_remaintexts know_leavetexts
tab know_remaintexts

*Frequency of search for info on TV
gen media_tvr = media_tv/7
label var media_tvr "Frequency of search for news on Brexit ref on TV"
label def media_tvr 0 "Never" 1 "Several times a day"
label val media_tvr media_tvr
ta media_tvr

*Frequency of search for info on newspapers
gen media_newsr = media_news/7
label var media_newsr "Frequency of search for news on Brexit ref on newspapers"
label val media_newsr media_tv
ta media_newsr


**************
*ANALYSIS - Tables and figures for paper

*
*Table 2. Effects of information on pro-independence attitudes (Study 1) and pro-leave at-titudes (Study 2)
*Model 3
reg proleave_att i.group2##c.risk401
*Model 4
reg proleave_att i.group2##c.risk401 female age401 euid_dum

*
*Figure 2.	Effects of risk propensity on pro-change attitudes by treatment conditions (experimental results)
*Right-hand plot
reg proleave_att i.group2##c.risk401 female age401 euid_dum
margins group2, dydx(risk401) level(90) post
coefplot, horiz xline(0) level(90) name(fig2brex)

**************
*ANALYSIS - Tables and figures for appendix

*
*Table A7. Randomization checks (Study 2, EU referendum)
fre riskW1
ttest riskW1 if group3==1 | group3==2, by(group3)
ttest riskW1 if group3==1 | group3==3, by(group3)
ttest age if group3==1 | group3==2, by(group3)
ttest age if group3==1 | group3==3, by(group3)
tab female group3 if group3==1 | group3==2, col chi2
tab female group3 if group3==1 | group3==3, col chi2
tab euid_dum group3 if group3==1 | group3==2, col chi2
tab euid_dum group3 if group3==1 | group3==3, col chi2

*
*Table A8. Effects of information on pro-leave attitudes, separate treatment groups (Study 2, EU ref-erendum)
*Model 1
reg proleave_att i.group3##c.risk401
*Model 2
reg proleave_att i.group3##c.risk401 female age401 euid_dum
*Model 3
reg proleave_att ib2.group3##c.risk401
*Model 4
reg proleave_att ib2.group3##c.risk401 female age401 euid_dum

*
*Table A9. Knowledge of arguments and media use by risk propensity (Study 2, EU referendum)
recode risk4 (1/2=1 "Risk averse") (3/4=2 "Risk taker"), gen(risk2)
*Group1
ttest know_leavetexts if group3==2, by(risk2)
ttest know_remaintexts if group3==2, by(risk2)
ttest media_tvr if group3==2, by(risk2)
ttest media_newsr if group3==2, by(risk2)
*Group2
ttest know_leavetexts if group3==3, by(risk2)
ttest know_remaintexts if group3==3, by(risk2)
ttest media_tvr if group3==3, by(risk2)
ttest media_newsr if group3==3, by(risk2)

*
*Figure A1. Support for leaving the EU by risk-propensity categories and experimental conditions (Study 2, EU referendum)
reg proleave_att i.group3##c.risk4 female age401 euid_dum
margins group3, at(risk4=1) level(90)
marginsplot, recast(bar) plotopts(barw(.8)) name(risk1A)
reg proleave_att i.group3##c.risk4 female age401 euid_dum
margins group3, at(risk4=2) level(90)
marginsplot, recast(bar) plotopts(barw(.8)) name(risk2A)
reg proleave_att i.group3##c.risk4 female age401 euid_dum
margins group3, at(risk4=3) level(90)
marginsplot, recast(bar) plotopts(barw(.8)) name(risk3A)
reg proleave_att i.group3##c.risk4 female age401 euid_dum
margins group3, at(risk4=4) level(90)
marginsplot, recast(bar) plotopts(barw(.8)) name(risk4A)
graph combine risk1A risk2A risk3A risk4A 

